Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LG-14010 - More detailed error page for Socure errors #11560

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jmax-gsa
Copy link
Contributor

@jmax-gsa jmax-gsa commented Nov 26, 2024

Added plumbing and UX display for categorized Socure errors.

changelog Upcoming Features, Socure, Added nice error displays

🎫 Ticket

Link to the relevant ticket:
LG-14010

🛠 Summary of changes

Passed the Socure errors through from the original DocV response back through the document capture result, then added a presenter and updated error page to display it all nicely.

📜 Testing Plan

This test procedure requires a sandbox set up to use Socure. See jmax
or Doug to coordinate use of one.

  • SSM into the sandbox and modify the file
    /srv/idp/current/app/services/doc_auth/socure/responses/docv_result_response.rb. Insert
    the following lines after line 36:
    # KLUDGE
    parsed_body['documentVerification']['decision']['value'] = 'reject'
    parsed_body['documentVerification']['reasonCodes'] = ['I848']
  • Exit the SSM sesion and reboot Puma

  • Connect to the IDP, create an account, and begin IdV. Verify that
    you end up on the Category 1 error page.

  • Cancel out of IdV and return to your account page.

  • SSM into the sandbox and modify the above file once again. Change the error code from 'I848' to 'I849'.

  • Exit the SSM session and reboot Puma

  • Connect to the IDP, create an account, and begin IdV. Verify that
    you end up on the Category 2 error page.

  • Cancel out of IdV and return to your account page.

  • SSM into the sandbox and modify the above file once again. Change the error code from 'I849' to 'R827'.

  • Exit the SSM session and reboot Puma

  • Connect to the IDP, create an account, and begin IdV. Verify that
    you end up on the Category 3 error page.

  • Cancel out of IdV and return to your account page.

  • SSM into the sandbox and modify the above file once again. Change the error code from 'R827' to 'I808'.

  • Exit the SSM session and reboot Puma

  • Connect to the IDP, create an account, and begin IdV. Verify that
    you end up on the Category 4 error page.

  • Cancel out of IdV and return to your account page.

  • SSM into the sandbox and modify the above file once again. Change the error code from 'I808' to 'R845'.

  • Exit the SSM session and reboot Puma

  • Connect to the IDP, create an account, and begin IdV. Verify that
    you end up on the Category 5 error page.

  • Cancel out of IdV and return to your account page.

  • SSM into the sandbox and modify the above file once again. Change the error code from 'R845' to 'I856'.

  • Exit the SSM session and reboot Puma

  • Connect to the IDP, create an account, and begin IdV. Verify that
    you end up on the Category 6 error page.

  • Cancel out of IdV and return to your account page.

  • SSM into the sandbox and modify the above file once again. This
    time, remove the error code line completely and replace it with
    raise "Some error"

  • Exit the SSM session and reboot Puma

  • Connect to the IDP, create an account, and begin IdV. Verify that
    you end up on the Category 7 error page.

  • Cancel out of IdV, return to your account page, and log out.

👀 Screenshots

If relevant, include a screenshot or screen capture of the changes.

Category 1 error page

image

Category 2 error page

image

Category 3 error page

image

Category 4 error page

image

Category 5 error page

image

Category 6 errpr page

image

Category 7 error page

image

Added plumbing and UX display for categorized Socure errors.

changelog Upcoming Features, Socure, Added nice error displays
changelog: Upcoming Features, Socure, Added nice error display for Socure failures
@jmax-gsa jmax-gsa marked this pull request as ready for review November 26, 2024 16:14
form_response_params[:extra] = extra unless extra.nil?
FormResponse.new(**form_response_params)
end

def make_error_hash(message)
Rails.logger.info("make_error_hash: stored_result: #{stored_result.inspect}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we intending to log this?

def failure(message, extra = nil)
flash[:error] = message
form_response_params = { success: false, errors: { message: message } }
def failure(message = nil, extra = nil)
Copy link
Contributor

@amirbey amirbey Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it appear that failure is only called once passing message as nil. i understand this is following the pattern for defining the failure method throughout the application; however, could it be worth eliminating this failure method definition and instead of calling it use the below

FormResponse.new(
{
success: false,
errors: make_error_hash(message),
extra: extra}
}.compact
)

Comment on lines +46 to +52
error_hash = { message: message || I18n.t('doc_auth.errors.general.network_error') }

if stored_result&.errors&.has_key?(:socure)
error_hash[:socure] = stored_result.errors[:socure]
end

error_hash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error_hash = { message: message || I18n.t('doc_auth.errors.general.network_error') }
if stored_result&.errors&.has_key?(:socure)
error_hash[:socure] = stored_result.errors[:socure]
end
error_hash
{
message: message || I18n.t('doc_auth.errors.general.network_error'),
socure: stored_result&.errors&.dig(:socure)
}.compact

this seems simpler to me, just a suggestion

@@ -34,6 +34,7 @@ class DocvResultResponse < DocAuth::Response

def initialize(http_response:, biometric_comparison_required: false)
@http_response = http_response

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +14 to +25
else
icon_name = :warning
end

troubleshooting_heading = local_assigns.fetch(:troubleshooting_heading) do
if local_assigns.fetch(:type, :error) == :error
troubleshooting_heading = t('idv.troubleshooting.headings.need_assistance')
else
troubleshooting_heading = t('components.troubleshooting_options.default_heading')
end
end
%>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason to change this and add new lines? 🤔

@presenter = socure_errors_presenter(handle_stored_result)
end

def goto_in_person
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having the controller action inside of the concern feels a bit buried 🤔 i didn't realize this was a controller action until I saw the routes file 😬

verify_info_controller#update has a pattern worth considering

form_response_params[:extra] = extra unless extra.nil?
FormResponse.new(**form_response_params)
end

def make_error_hash(message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def make_error_hash(message)
def error_hash(message)

Comment on lines +149 to +158
if remapped_error(error_code) == 'underage' # special handling because it says 'Login.gov'
I18n.t('doc_auth.errors.underage', app_name: APP_NAME)
else
# i18n-tasks-use t('doc_auth.errors.unreadable_id')
# i18n-tasks-use t('doc_auth.errors.unaccepted_id_type')
# i18n-tasks-use t('doc_auth.errors.expired_id')
# i18n-tasks-use t('doc_auth.errors.low_resolution')
# i18n-tasks-use t('doc_auth.errors.id_not_found')
I18n.t("doc_auth.errors.#{remapped_error(error_code)}")
end
Copy link
Contributor

@amirbey amirbey Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if remapped_error(error_code) == 'underage' # special handling because it says 'Login.gov'
I18n.t('doc_auth.errors.underage', app_name: APP_NAME)
else
# i18n-tasks-use t('doc_auth.errors.unreadable_id')
# i18n-tasks-use t('doc_auth.errors.unaccepted_id_type')
# i18n-tasks-use t('doc_auth.errors.expired_id')
# i18n-tasks-use t('doc_auth.errors.low_resolution')
# i18n-tasks-use t('doc_auth.errors.id_not_found')
I18n.t("doc_auth.errors.#{remapped_error(error_code)}")
end
remapped_error_code = remapped_error(error_code)
if remapped_error_code == 'underage' # special handling because it says 'Login.gov'
I18n.t('doc_auth.errors.underage', app_name: APP_NAME)
else
# i18n-tasks-use t('doc_auth.errors.unreadable_id')
# i18n-tasks-use t('doc_auth.errors.unaccepted_id_type')
# i18n-tasks-use t('doc_auth.errors.expired_id')
# i18n-tasks-use t('doc_auth.errors.low_resolution')
# i18n-tasks-use t('doc_auth.errors.id_not_found')
I18n.t("doc_auth.errors.#{remapped_error_code}")
end

Comment on lines +374 to +375
get '/hybrid_mobile/socure/document_capture_errors' => 'hybrid_mobile/socure/document_capture#errors', as: :hybrid_mobile_socure_document_capture_errors
get '/hybrid_mobile/socure/document_capture_goto_in_person' => 'hybrid_mobile/socure/document_capture#goto_in_person', as: :hybrid_mobile_socure_document_capture_goto_in_person
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
get '/hybrid_mobile/socure/document_capture_errors' => 'hybrid_mobile/socure/document_capture#errors', as: :hybrid_mobile_socure_document_capture_errors
get '/hybrid_mobile/socure/document_capture_goto_in_person' => 'hybrid_mobile/socure/document_capture#goto_in_person', as: :hybrid_mobile_socure_document_capture_goto_in_person
get '/hybrid_mobile/socure/errors/warning' => 'hybrid_mobile/socure/document_capture#errors', as: :hybrid_mobile_socure_document_capture_errors
get '/hybrid_mobile/socure/errors/in_person' => 'hybrid_mobile/socure/document_capture#goto_in_person', as: :hybrid_mobile_socure_document_capture_goto_in_person

looking at how we handle errors for other idv checks ... it seems like they generally have a errors controller. what do you think about following this pattern?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants